<?php
$mid=$_GET['mid'];
$smid=$_GET['smid'];
require_once('includes/connection.php');
    $uid=$_POST['uid'];
	$name=$_POST['name'];
	$email=$_POST['email'];
	$login=$_POST['login'];
	$password=$_POST['password'];
	$dept=$_POST['dept'];
	$reportmgr=$_POST['reportmgr'];
	$tenure=$_POST['tenure'];
	$billsts=$_POST['billsts'];
	$empsts=$_POST['empsts'];
	if ($_REQUEST['from'])
	{
		$prj_start=substr($_REQUEST['from'],6,4)."-".substr($_REQUEST['from'],3,2)."-".substr($_REQUEST['from'],0,2);
	}
    if ($_REQUEST['to'])
	{
		$prj_end=substr($_REQUEST['to'],6,4)."-".substr($_REQUEST['to'],3,2)."-".substr($_REQUEST['to'],0,2);
	}
	
	$password1=sha1($password);	
	if($password=="")
	{
	$res=mysql_query("update users set Email='$email',Name='$name',Login='$login',department='$dept',reporting_mgr='$reportmgr',dt_ofjoin='$prj_start',dt_ofleave='$prj_end',tenure='$tenure',billing_status='$billsts',emp_status='$empsts' where id='$uid'");
	}
	else
	{
	$res=mysql_query("update users set Email='$email',Name='$name',Login='$login',Password='$password1',department='$dept',reporting_mgr='$reportmgr',dt_ofjoin='$prj_start',dt_ofleave='$prj_end',tenure='$tenure',billing_status='$billsts',emp_status='$empsts' where id='$uid'");
	}
	if($res)
	{
	print "<script>";
	print "self.location='modules.php?file=user_list&mid=$mid&smid=$smid'";		
	print "</script>";
	}
?>